package com.lc202407;

public class Solution258 {
    public int addDigits1(int num) {
        return (num - 1) % 9 + 1;
    }

    public int addDigits(int num) {
        if (num == 0) {
            return 0;
        }
        int res = num % 9;
        return res == 0 ? 9 : res;
    }
}
